package com.biz;

import java.util.ArrayList;

import com.dao.MemberDAO;
import com.entity.Manager;
import com.entity.Member;

public class MemberBiz {
	
	public int memberLogin(String id, String passwd) {
		int n = -1;
		MemberDAO dao = new MemberDAO();
		Member mem = dao.selectLogin(id, passwd);
		if (mem != null){
			if(mem instanceof Manager){
				n = 1;
			}
			else{
				n = 0;
			}
		}

		return n;
	}

	public int insert(String id, String passwd, String name, String address,
			String phone, String email) {
		MemberDAO dao = new MemberDAO();
		return dao.insert(id, passwd, name, address, phone, email);
	}

	public int update(String id, String passwd, String name, String address,
			String phone, String email) {
		MemberDAO dao = new MemberDAO();
		return dao.update(id, passwd, name, address, phone, email);
	}

	public int delete(String id) {
		MemberDAO dao = new MemberDAO();
		return dao.delete(id);
	}

	public ArrayList<Member> select() {
		MemberDAO dao = new MemberDAO();
		return dao.select();
	}
	
	public Member selectByName(String name){
		MemberDAO dao = new MemberDAO();
		return dao.selectByName(name);
	}
	
	public Member selectByID(String id){
		MemberDAO dao = new MemberDAO();
		return dao.selectByID(id);
	}

}
